function Opportunities()
{
	this.getOpportunities = function(type)
	{
	
		if(type == undefined)
		{
			return null;
		}
		//can be changed to a switch statement
		var seed = 0;
		var opps = [];
		var seedsUsed = [];
		if(type == 'bank')
		{
			//pick bank stuff must pick go home
			opps.push(opportunities['bank'][0]);
			seedsUsed.push(0);
			while(seedsUsed.length < 3)
			{
				seed = Math.round(Math.random()*(opportunities['bank'].length-1));
				while(seedsUsed.indexOf(seed) != -1)
				{
					seed = Math.round(Math.random()*(opportunities['bank'].length-1));
				}
				opps.push(opportunities['bank'][seed]);
				
				seedsUsed.push(seed);
			}
			
		}
		else if (type == 'parents')
		{
			//parents house
			//pick a chance event that will happen
			seed = Math.round(Math.random()*(opportunities['parents'].length-1));
			opps.push(opportunities['parents'][seed]);
		}
		else if(type == 'bar')
		{
			//bar stuff must pick go home
			opps.push(opportunities['bar'][0]);
			seedsUsed.push(0);
			while(seedsUsed.length < 3)
			{
				seed = Math.round(Math.random()*(opportunities['bar'].length-1));
				while(seedsUsed.indexOf(seed) != -1)
				{
					seed = Math.round(Math.random()*(opportunities['bar'].length-1));
				}
				opps.push(opportunities['bar'][seed]);
				seedsUsed.push(seed);
			}
		}
		else
		{
			//mall or uni
			while(seedsUsed.length < 3)
			{
				seed = Math.round(Math.random()*(opportunities[type].length-1));
				while(seedsUsed.indexOf(seed) != -1)
				{
					seed = Math.round(Math.random()*(opportunities[type].length-1));
				}
				opps.push(opportunities[type][seed]);
				seedsUsed.push(seed);
			}
			
		}
		//console.log(opps);
		return opps;
	}
	
	
	var opportunities = 
	{
		bar: 
		[
			{
				name: 'Go Home',
				description: 'Responsibility is cool',
				outcome: 'Being lame, lose 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
				}
			},
			{
				name: 'Drink',
				description: 'I\'ll have the regular',
				outcome: 'Had a bottle of beer, spend $20 for 5 happiness!',
				execute: function()
				{
					
					if(game.traits.checkTrait('Alcoholic'))
					{
						game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
						game.logic.person.money -= 100 + Math.round(game.difficulty * 100);
						game.logic.person.timesPartied += 2 + Math.round((1 - game.difficulty) * 2);
					}
					else
					{
						game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
						game.logic.person.money -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.timesPartied += 1 + Math.round((1 - game.difficulty) * 1);
					}
				}
			},
			{
				name: 'Party - Crazy mode',
				description: 'Time to cut lose, have some fun!',
				outcome: 'You are having fun, but you got into a fight! You lose 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness -= 5 + Math.round(game.difficulty * 10);
					game.logic.person.timesPartied += 2 + Math.round((1 - game.difficulty) * 2);
				}
			},
			{
				name: 'Party - Im a fun person mode',
				description: 'Time to cut lose, have some fun!',
				outcome: 'You got "lucky" tonight! Spent $100 for 20 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
					game.logic.person.money -= 100 + Math.round(game.difficulty * 100);
					game.logic.person.timesPartied += 2 + Math.round((1 - game.difficulty) * 2);
				}
			},
			{
				name: 'Party - casual mode',
				description: 'Time to cut lose, have some fun!',
				outcome: 'Had a few shots but nothing crazy happened, Gain 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.timesPartied += 1 + Math.round((1 - game.difficulty) * 1);
				}
			}
		],
		university: 
		[
			{
				name: 'Apply for scholarship',
				description: 'It\'s basically free money',
				outcome: 'Sorry, you didn\'t get the scholarship!',
				execute: function()
				{
					if(Math.random() >= 0.6 + (0.4 * game.difficulty))
					{
						game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
						game.logic.person.money += 5000 + Math.round((1 - game.difficulty) * 5000);
						this.outcome = 'Gain $5000 and 10 happiness!';
					}					
				}
			},
			{
				name: 'Apply to be a TA',
				description: 'Thankless work',
				outcome: 'Gain $40 and lose 5 happiness every week',
				execute: function()
				{
					/*
					while(game.day%7 == 0)
					{
						game.logic.person.money += 40 + (1 - game.difficulty) * 40;
					}
					*/
					//adds an income event
					var income = function()
					{
						game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
						game.logic.person.money += 40 + Math.round((1 - game.difficulty) * 40);
					};
					game.manager.addToInventory(
						'T.A. Paycheck', //name
						income, //function
						7, //freq
						0, //prob
						'Turning assignments into cold hard cash', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply for Research Assistantship',
				description: 'Find the next breakthrough, or sit around a lab 20 hours a week',
				outcome: 'Gain $80 and lose 5 happiness every week!',
				execute: function()
				{
					var income = function()
					{
						game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
						game.logic.person.money += 80 + Math.round((1 - game.difficulty) * 80);
					};
					game.manager.addToInventory(
						'Assistantship Paycheck', //name
						income, //function
						7, //freq
						0, //prob
						'Turning research into cold hard cash', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply to be a tutor',
				description: 'They won\'t know if you\'re lying to them',
				outcome: 'Gain $10 and lose 5 happiness every week',
				execute: function()
				{
					var income = function()
					{
						game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
						game.logic.person.money += 10 + Math.round((1 - game.difficulty) * 10);
					};
					game.manager.addToInventory(
						'Tutor Paycheck', //name
						income, //function
						7, //freq
						0, //prob
						'Turning assignments into cold hard cash', //desc
						false //display?
					);
				}
			},
			{
				name: 'Check-out a book from library',
				description: 'Win with reading: pencil not included',
				outcome: 'Lose 5 happiness! This will boost up your GPA!',
				execute: function()
				{
					game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
					game.logic.person.timesStudied += 1 + Math.round((1 - game.difficulty) * 1);
				}
			},
			{
				name: 'Get homework done',
				description: 'Someone has to do it',
				outcome: 'Lose 5 happiness! This will boost up your GPA!',
				execute: function()
				{
					game.logic.person.happiness -= 5 + Math.round(game.difficulty * 5);
					game.logic.person.timesStudied += 1 + Math.round((1 - game.difficulty) * 1);
				}
			},
			{
				name: 'Study for upcoming exam',
				description: 'So that\'s what a Taylor Series is...',
				outcome: 'Lose 10 happiness! This will boost up your GPA!',
				execute: function()
				{
					game.logic.person.happiness -= 10 + Math.round(game.difficulty * 10);
					game.logic.person.timesStudied += 2 + Math.round((1 - game.difficulty) * 2);
				}
			},
			{
				name: 'Hang out with friends',
				description: 'The usual crowd',
				outcome: 'Gain 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
				}
			},
			{
				name: 'Workout',
				description: 'Budweiser + protein powder + ??? = GAINS',
				outcome: 'Gain 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
				}
			},
			{
				name: 'Skydiving',
				description: 'Chance for manufacturing defects',
				outcome: 'You spend $200 for 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
					game.logic.person.money -= 200 + Math.round(game.difficulty * 200);
				}
			},
			{
				name: 'Game Night',
				description: 'Down for some Settlers of Catan?',
				outcome: 'Gain 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
				}
			},
			{
				name: 'Movie Night',
				description: 'Free popcorn and movie, but no seats left',
				outcome: 'You spend $20 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 20 + Math.round(game.difficulty * 20);
				}
			},
			{
				name: 'Scavenger Hunt',
				description: 'Good times are guaranteed',
				outcome: 'Gain 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
				}
			},
			{
				name: 'Pot Luck dinner',
				description: 'The last Bishop\'s buffet left',
				outcome: 'You spend $20 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 50 + Math.round(game.difficulty * 50);
				}
			},
		],
		mall: 
		[
			{
				name: 'Apply to be a Sales Representative',
				description: 'Would you like to sign up for our company credit card?',
				outcome: 'Gain $1040 and lose 20 happiness every month!',
				execute: function()
				{
					/*
					while(game.day%30)
					{
						game.logic.person.money += 1040 + (1 - game.difficulty) * 1040; //$13 per hr, 20 hrs per week
					}
					*/
					var income = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money += 1040 + Math.round((1 - game.difficulty) * 1040);
					};
					game.manager.addToInventory(
						'Sales Representative Paycheck', //name
						income, //function
						30, //freq
						0, //prob
						'Got a paycheck', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply to be a Janitor',
				description: 'Vomit on aisle 3',
				outcome: 'Gain $560 and lose 20 happiness every month!',
				execute: function()
				{
					/*
					while(game.day%30)
					{
						game.logic.person.money += 560 + (1 - game.difficulty) * 560; //$7 per hr, 20 hrs per week
					}
					*/
					var income = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money += 560 + Math.round((1 - game.difficulty) * 560);
					};
					game.manager.addToInventory(
						'Janitor Paycheck', //name
						income, //function
						30, //freq
						0, //prob
						'Got a paycheck', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply to be a Server',
				description: 'A smile can brighten your day!',
				outcome: 'Gain $640 and lose 20 happiness every month!',
				execute: function()
				{
					/*
					while(game.day%30)
					{
						game.logic.person.money += 640 + (1 - game.difficulty) * 640; //$8 per hr, 20 hrs per week
					}
					*/
					var income = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money += 640 + Math.round((1 - game.difficulty) * 640);
					};
					game.manager.addToInventory(
						'Server Paycheck', //name
						income, //function
						30, //freq
						0, //prob
						'Got a paycheck', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply to be a Retail Associate',
				description: 'How are you today?',
				outcome: 'Gain $880 and lose 20 happiness every month!',
				execute: function()
				{
					/*
					while(game.day%30)
					{
						game.logic.person.money += 880 + (1 - game.difficulty) * 880; //$11 per hr, 20 hrs per week
					}
					*/
					var income = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money += 880 + Math.round((1 - game.difficulty) * 880);
					};
					game.manager.addToInventory(
						'Retail Associate Paycheck', //name
						income, //function
						30, //freq
						0, //prob
						'Got a paycheck', //desc
						false //display?
					);
				}
			},
			{
				name: 'Apply to be a Visual Merchandiser',
				description: 'Who doesn\'t like visual?',
				outcome: 'Gain $1120 and lose 20 happiness every month!',
				execute: function()
				{
					/*
					while(game.day%30)
					{
						game.logic.person.money += 1120 + (1 - game.difficulty) * 1120; //$14 per hr, 20 hrs per week
					}
					*/
					var income = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money += 1120 + Math.round((1 - game.difficulty) * 1120);
					};
					game.manager.addToInventory(
						'Visual Merchandiser Paycheck', //name
						income, //function
						30, //freq
						0, //prob
						'Got a paycheck', //desc
						false //display?
					);
				}
			},
			{
				name: 'Go to a movie',
				description: 'Romantic comedies never get old!',
				outcome: 'You spend $40 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 40 + Math.round(game.difficulty * 40);
				}
			},
			{
				name: 'Candlelight Dinner',
				description: 'WWCD: What would Casanova do?',
				outcome: 'You spend $160 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 160 + Math.round(game.difficulty * 160);
				}
			},
			{
				name: 'Arcade',
				description: 'Tekken is way too hard!',
				outcome: 'You spend $50 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 50 + Math.round(game.difficulty * 50);
				}
			},
			{
				name: 'Couple Massage',
				description: 'It\'s time to relax!',
				outcome: 'You spend $300 for 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
					game.logic.person.money -= 300 + Math.round(game.difficulty * 300);
				}
			},
			{
				name: 'Buy a car',
				description: 'Chevy Cavalier, pinnacle of American engineering for only $5000',
				outcome: 'You spend $5000 for 20 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 20 + Math.round((1 - game.difficulty) * 20);
					game.logic.person.money -= 5000 + Math.round(game.difficulty * 5000);
					var carTicket = function()
					{
						game.logic.person.happiness -= 10 + Math.round(game.difficulty * 10);
						game.logic.person.money -= 50 + Math.round((1 - game.difficulty) * 50);
					};
					game.manager.addToInventory(
						'Car Ticket', //name
						carTicket, //function
						-1, //freq
						0.05, //prob
						'You got a parking ticket!', //desc
						true //display?
					);
					var carBreakdown = function()
					{
						game.logic.person.happiness -= 20 + Math.round(game.difficulty * 20);
						game.logic.person.money -= 1000 + Math.round((1 - game.difficulty) * 1000);
					};
					game.manager.addToInventory(
						'Car Breakdown', //name
						carBreakdown, //function
						-1, //freq
						0.01, //prob
						'Your car broke down!', //desc
						true //display?
					);
				}
			},
			{
				name: 'Buy clothes',
				description: 'Nice threads, daddio',
				outcome: 'You spend $100 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 100 + Math.round(game.difficulty * 100);
				}
			},
			{
				name: 'Buy Jewelry',
				description: 'Diamonds are forever, and overpriced',
				outcome: 'You spend $200 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 200 + Math.round(game.difficulty * 200);
				}
			},
			{
				name: 'Buy books',
				description: 'Knowledge is power',
				outcome: 'You spend $50 for 5 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
					game.logic.person.money -= 50 + Math.round(game.difficulty * 50);
				}
			},
			{
				name: 'Buy a laptop',
				description: 'This will be perfect for browsing Facebook',
				outcome: 'You spend $400 for 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 20 + Math.round((1 - game.difficulty) * 20);
					game.logic.person.money -= 400 + Math.round(game.difficulty * 400);
				}
			},
			{
				name: 'Buy an iPhone',
				description: 'It just works',
				outcome: 'You spend $500 for 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
					game.logic.person.money -= 500 + Math.round(game.difficulty * 500);
				}
			},
			{
				name: 'Buy an Xbox',
				description: '3 months of fun ending in a red ring',
				outcome: 'You spend $300 for 10 happiness!',
				execute: function()
				{
					game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
					game.logic.person.money -= 300 + Math.round(game.difficulty * 300);
				}
			},
			],
		parents: 
		[
			{
				name: 'Just Desserts',
				description: 'They owe you this money',
				outcome: 'You had a fun time with your family!',
				execute: function()
				{
					if(game.traits.checkTrait('Rich Dad'))
					{
						game.logic.person.happiness += 15 + Math.round((1 - game.difficulty) * 15);
						game.logic.person.money += 300 + Math.round((1 - game.difficulty) * 300);
					}
					else if(game.traits.checkTrait('Poor Dad'))
					{
						game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
						game.logic.person.money += 100 + Math.round((1 - game.difficulty) * 100);
					}
					else
					{
						game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
						game.logic.person.money += 200 + Math.round((1 - game.difficulty) * 200);
					}
				}
			},
			{
				name: 'Mom\'s lasagna',
				description: 'This will last ya',
				outcome: 'You had a fun time with your family!',
				execute: function()
				{
					if(game.traits.checkTrait('Rich Dad'))
					{
						game.logic.person.happiness += 15 + Math.round((1 - game.difficulty) * 15);
						game.logic.person.money += 300 + Math.round((1 - game.difficulty) * 300);
					}
					else if(game.traits.checkTrait('Poor Dad'))
					{
						game.logic.person.happiness += 5 + Math.round((1 - game.difficulty) * 5);
						game.logic.person.money += 100 + Math.round((1 - game.difficulty) * 100);
					}
					else
					{
						game.logic.person.happiness += 10 + Math.round((1 - game.difficulty) * 10);
						game.logic.person.money += 200 + Math.round((1 - game.difficulty) * 200);
					}
				}
			},
			{
				name: 'Mom hooked you up',
				description: 'Free groceries are the best groceries',
				outcome: 'Free groceries for a week. Save $50.',
				execute: function()
				{
					if(game.traits.checkTrait('Ramen Noodle Afficionado'))
					{
						game.logic.person.money += 30 + Math.round((1-game.difficulty)*30);
					}
					else
					{
						game.logic.person.money += 10 + Math.round((1-game.difficulty)*30);
					}
				}
			}
		],
		bank:
		[
			{
				name: 'Move On',
				description: 'Leave this wretched place behind',
				outcome: 'You\'re unlikely being robbed!',
				execute: function()
				{
					
				}
			},
			{
				name: 'Long Term Loan',
				description: '$5000 with 10% interest rate',
				outcome: 'You will have to pay $115 every month for 4 years!',
				execute: function()
				{
					game.logic.person.money += 5000;
					var loan = function()
					{
						game.logic.person.money -= 115;
					};
					game.manager.addToInventory(
						'Long Term Loan', //name
						loan, //function
						30, //freq
						0, //prob
						'Payment due', //desc
						false //display?
					);
				}
			},
			{
				name: 'Short Term Loan',
				description: '$2000 with 20% interest rate',
				outcome: 'You will have to pay $67 every month for 3 years!',
				execute: function()
				{
					game.logic.person.money += 2000;
					var loan = function()
					{
						game.logic.person.money -= 67;
					};
					game.manager.addToInventory(
						'Short Term Loan', //name
						loan, //function
						30, //freq
						0, //prob
						'Payment due', //desc
						false //display?
					);
				}
			},	
		]
	}
}